package com.yanqu.road.entity.activity.summergames;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_summer_games_user_data")
public class SummerGamesUserData extends DataObject {

    @FieldTypeAnnotation(select = true, update = true, desc = "活动ID")
    private int activityId;

    @FieldTypeAnnotation(select = true, update = true, desc = "玩家ID")
    private long userId;

    @FieldTypeAnnotation(desc = "比赛积分")
    private long score;

    @FieldTypeAnnotation(desc = "竞猜积分")
    private long guessScore;

    @FieldTypeAnnotation(desc = "抽奖进度")
    private Map<Integer, SummerGamesLottery> poolDrawProcess;

    @FieldTypeAnnotation(desc = "总抽数")
    private int drawTimes;

    @FieldTypeAnnotation(desc = "竞猜币-领取，每日")
    private Map<Long, Integer> dayGetGuessItemMap;

    @FieldTypeAnnotation(desc = "获得的奖牌数")
    private Map<Integer, Integer> medalsMap;

    @FieldTypeAnnotation(desc = "兑换数量")
    private Map<Integer, Integer> convertNumMap;

    @FieldTypeAnnotation(desc = "交换提醒")
    private Map<Long, SummerGamesExchangeTip> exchangeTipMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "自选奖励")
    private Map<Integer, SummerGamesSelectReward> convertSelectMap = new ConcurrentHashMap<>();

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if(this.activityId != activityId) {
            this.activityId = activityId;
            setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if(this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public long getScore() {
        return score;
    }

    public void setScore(long score) {
        if(this.score != score) {
            this.score = score;
            setUpdateOption();
        }
    }

    public long getGuessScore() {
        return guessScore;
    }

    public void setGuessScore(long guessScore) {
        if(this.guessScore != guessScore) {
            this.guessScore = guessScore;
            setUpdateOption();
        }
    }

    public Map<Integer, SummerGamesLottery> getPoolDrawProcess() {
        return poolDrawProcess;
    }

    public void setPoolDrawProcess(Map<Integer, SummerGamesLottery> poolDrawProcess) {
        this.poolDrawProcess = poolDrawProcess;
        setUpdateOption();
    }

    public int getDrawTimes() {
        return drawTimes;
    }

    public void setDrawTimes(int drawTimes) {
        if(this.drawTimes != drawTimes) {
            this.drawTimes = drawTimes;
            setUpdateOption();
        }
    }

    public Map<Long, Integer> getDayGetGuessItemMap() {
        return dayGetGuessItemMap;
    }

    public void setDayGetGuessItemMap(Map<Long, Integer> dayGetGuessItemMap) {
        this.dayGetGuessItemMap = dayGetGuessItemMap;
        setUpdateOption();
    }

    public Map<Integer, Integer> getMedalsMap() {
        return medalsMap;
    }

    public void setMedalsMap(Map<Integer, Integer> medalsMap) {
        this.medalsMap = medalsMap;
        setUpdateOption();
    }

    public Map<Integer, Integer> getConvertNumMap() {
        return convertNumMap;
    }

    public void setConvertNumMap(Map<Integer, Integer> convertNumMap) {
        this.convertNumMap = convertNumMap;
        setUpdateOption();
    }

    public void addConvertTimes(int id, int times){
        Integer integer = this.convertNumMap.getOrDefault(id, 0);
        this.convertNumMap.put(id, times + integer);
        setUpdateOption();
    }

    public Map<Long, SummerGamesExchangeTip> getExchangeTipMap() {
        return exchangeTipMap;
    }

    public void setExchangeTipMap(Map<Long, SummerGamesExchangeTip> exchangeTipMap) {
        this.exchangeTipMap = exchangeTipMap;
        setUpdateOption();
    }

    public Map<Integer, SummerGamesSelectReward> getConvertSelectMap() {
        return convertSelectMap;
    }

    public void setConvertSelectMap(Map<Integer, SummerGamesSelectReward> convertSelectMap) {
        this.convertSelectMap = convertSelectMap;
        setUpdateOption();
    }
}
